/**
 * 
 */
package switchviz.gui;

import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;

/**
 * @author Thomas
 *
 */
public class MenuBar extends JMenuBar
{
	private static final long serialVersionUID = 1L;
	
	private JMenu _fileMenu = null;
	private JMenu _helpMenu = null;

	private JMenuItem _exitMenuItem 	= null;
	private JMenuItem _aboutMenuItem 	= null;
	private JMenuItem _importViewMenuItem = null;
	private JMenuItem _importRecordMenuItem = null;
	private JMenuItem _exportViewMenuItem = null;
	private JMenuItem _exportRecordMenuItem = null;
	private JMenuItem _userManualMenuItem = null;

	public MenuBar()
	{
		initialize();
	}

	public JMenuItem getExitMenuItem()
	{
		if (_exitMenuItem == null)
		{
			_exitMenuItem = new JMenuItem();
			_exitMenuItem.setText("Exit");
		}
		return _exitMenuItem;
	}
	

	
	public JMenuItem getAboutMenuItem()
	{
		if (_aboutMenuItem == null)
		{
			_aboutMenuItem = new JMenuItem();
			_aboutMenuItem.setText("About");
		}
		
		return _aboutMenuItem;
	}
	
	private void initialize()
	{
		this.add(getFileMenu());
		this.add(getJHelpMenu());
	}

	private JMenu getFileMenu()
	{
		if (_fileMenu == null)
		{
			_fileMenu = new JMenu();
			_fileMenu.setText("File");
			
			_fileMenu.add(getImportViewMenuItem());
			_fileMenu.add(getImportRecordMenuItem());
			_fileMenu.addSeparator();
			
			_fileMenu.add(getExportViewMenuItem());
			_fileMenu.add(getExportRecordMenuItem());
			_fileMenu.addSeparator();
			
			_fileMenu.add(getExitMenuItem());
		}
		
		return _fileMenu;
	}
	
	private JMenu getJHelpMenu()
	{
		if (_helpMenu == null)
		{
			_helpMenu = new JMenu();
			_helpMenu.setText("Help");
			_helpMenu.add(getAboutMenuItem());
			_helpMenu.add(getUserManualMenuItem());
		}
		
		return _helpMenu;
	}

	public JMenuItem getImportViewMenuItem() 
	{
		if(_importViewMenuItem == null)
		{
			_importViewMenuItem = new JMenuItem();
			_importViewMenuItem.setText("Import View");
		}
		return _importViewMenuItem;
	}

	public JMenuItem getImportRecordMenuItem() 
	{
		if(_importRecordMenuItem == null)
		{
			_importRecordMenuItem = new JMenuItem();
			_importRecordMenuItem.setText("Import Record");
		}
		return _importRecordMenuItem;
	}
	
	public JMenuItem getExportViewMenuItem() 
	{
		if(_exportViewMenuItem == null)
		{
			_exportViewMenuItem = new JMenuItem();
			_exportViewMenuItem.setText("Export View");
		}
		return _exportViewMenuItem;
	}

	public JMenuItem getExportRecordMenuItem() 
	{
		if(_exportRecordMenuItem == null)
		{
			_exportRecordMenuItem = new JMenuItem();
			_exportRecordMenuItem.setText("Export Record");
		}
		return _exportRecordMenuItem;
	}
	
	public JMenuItem getUserManualMenuItem()
	{
		if(_userManualMenuItem == null)
		{
			_userManualMenuItem = new JMenuItem();
			_userManualMenuItem.setText("Open User Manual");
		}
		return _userManualMenuItem;
	}
}
